package com.greenline.push.core.pushcenter.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.greenline.push.core.pushcenter.DomainAppTemplateManager;
import com.greenline.push.dal.pushcenter.DomainAppTemplateDAO;
import com.greenline.push.dal.pushcenter.dataobject.DomainAppTemplateDO;
import com.greenline.push.dal.query.DomainAppTemplateQuery;

public class DomainAppTemplateManagerImpl implements DomainAppTemplateManager {

    @Autowired
    DomainAppTemplateDAO domainAppTempDAO;

    @Override
    public Long insert(DomainAppTemplateDO appDomainTempDO) {
        return domainAppTempDAO.insert(appDomainTempDO);
    }

    @Override
    public DomainAppTemplateDO getAppDomainTemplateById(Long id) {
        return domainAppTempDAO.getById(id);
    }

    @Override
    public boolean update(DomainAppTemplateDO appDomainTempDO) {
        if (appDomainTempDO.getId() == null) {
            return false;
        }
        return domainAppTempDAO.update(appDomainTempDO) > 0;
    }

    @Override
    public DomainAppTemplateQuery listByQuery(DomainAppTemplateQuery query) {
        return domainAppTempDAO.listByQuery(query);
    }

    @Override
    public boolean delete(Long id) {
        return domainAppTempDAO.delete(id) > 0;
    }

    @Override
    public List<DomainAppTemplateDO> getAppDomainTemplateListByDomainId(Long domainId) {
        return domainAppTempDAO.getByDomainId(domainId);
    }

    @Override
    public Integer getPriorityByApptemplateId(Long apptemplateId) {
        return domainAppTempDAO.getPriorityByApptemplateId(apptemplateId);
    }

}
